import request from '@/utils/request'

const api_name = "/admin/el/paper"

export default {   
  //查询全部-分页查询
    getPageList(page,limit,searchObj){
        return request({
            url:`${api_name}/${page}/${limit}`, 
            method: 'get',      //请求方式
            params: searchObj //参数
          })
    },

    //根据试卷id查询到试卷包含的题目Qu
    SelectQuByPaperId(paperid,searchObj){
      return request({
          url:`${api_name}/PaperQu/${paperid}`, 
          method: 'get',
          params: searchObj //参数
        })
    },
    //刷新试卷的信息(目的：重新计算有多少道单选、多选、判断、论述题，并更新到数据库中)
    reFresh(paperid){
      return request({
          url:`${api_name}/refresh/${paperid}`, 
          method: 'get',
        })
    },

    //把某个题目添加到试卷上
    AddQuToRepo(paperid,quid){
      return request({
          url:`${api_name}/addQuToPaper/${paperid}/${quid}`, 
          method: 'get',
        })
    },

//删除
    DeletePaper(id){
      return request({
        url:`${api_name}/${id}`, 
        method: 'delete',      //请求方式
      })
    },
  //试卷上中删除某题
  removeQuToPaper(paperid,quid){
    return request({
      url:`${api_name}/removeQuToPaper/${paperid}/${quid}`, 
      method: 'delete',      //请求方式
    })
  },

//查询单个
    SelectByID(id){
      return request({
        url:`${api_name}/${id}`, 
        method: 'get',
      })
    },
//更新
    Updata(ElPaper){
      return request({
        url:`${api_name}`, 
        method: 'put',
        data: ElPaper
      })
    },
//添加
    Add(ElPaper){
      return request({
        url:`${api_name}`, 
        method: 'post',
        data: ElPaper
      })
    },
//批量删除
    DeleteByIds(idList){
      return request({
        url: `${api_name}/batchRemove`,
        method: `delete`,
        data: idList
      })
    },

    
}